﻿using Architecture.Domain.Service;
using Architecture.Repository.Interface;
using MediatR;
using RBAC.ZhuBoLin.Application.Command.RoleCommand.RoleMenu;

namespace RBAC.ZhuBoLin.Application.CommandHandlers.RoleHandler.RoleMenu
{
    public class RoleMenuCreateCommandHandler : IRequestHandler<RoleMenuCreateCommand, int>
    {
        protected readonly IRoleMneuService service;

        public RoleMenuCreateCommandHandler(IRoleMneuService service)
        {
            this.service = service;
        }

        public async Task<int> Handle(RoleMenuCreateCommand request, CancellationToken cancellationToken)
        {
            return await service.RoleMenuAdd(request.RoleInfoid, request.MenuInfoid);
        }
    }
}
